#ifndef __FILESTREAM_H__
#define __FILESTREAM_H__

#include <stdio.h>

#include "stream.h"

#define FILESTREAM_CAST(x) ((FileStream *)(x))

typedef struct _FileStream
{
  Stream stream;

  FILE *file;
} FileStream;

void filestream_create (FileStream *fs, char *filename);

static void filestream_write (Stream *s, void *src, int size);
static int filestream_read (Stream *s, void *dest, int num_read,
                            int dest_offset);
static void filestream_seek (Stream *s, int offset, SeekWhence whence);
static int filestream_pos (Stream *s);
static int filestream_size (Stream *s);
static void filestream_close (Stream *s);

#endif
